<!--  -->
<template>
  <div class="goodsItem" @click="itemClick">
      <img :src="isShow" alt="" @load="itemLoad">
      <div class="goods_info">
        <p>{{goodsitem.title}}</p>
        <span class="price">{{goodsitem.price}}</span>
        <span class="cfav">{{goodsitem.cfav}}</span>
      </div>

  </div>
</template>

<script>
export default {
  data () {
    return {
    }
  },
  props:{
      goodsitem:{
          type:Object,
          default() {
              return {}
          }
      }
  },
  methods:{
    itemLoad() {
      this.$bus.emit('itemLoad')
    },
    itemClick() {
      this.$router.push('/detail/' + this.goodsitem.iid)
    }
  },
  computed:{
    isShow() {
      return this.goodsitem.image || this.goodsitem.show.img
    }
  }
}
</script>

<style  scoped>
  .goodsItem{
    width: 48%;
    position: relative;
    padding-bottom: 40px;
  }
  .goodsItem img {
    width: 100%;
    border-radius: 5px;
  }
  .goods_info{
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    font-size: 12px;
    text-align: center;
  }
  .goods_info p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .price{
    color:var(--color-high-text);
    margin-right: 10px;
  }
  .cfav{
    position: relative;
    margin-left: 10px;
  }
  .cfav::before{
    content: '';
    position: absolute;
    top: -1px;
    left: -14px;
    right: 0;
    width: 14px;
    height: 14px;
    background: url('~assets/img/common/collect.svg') 0 0/14px 14px;
  }
</style>
